#!/bin/bash
# chkconfig: 2345 10 90
kib_path="/data/elk/kibana-7.15.1-linux-x86_64"
cd ${kib_path}

start() {
    sudo -u elkuser ./bin/kibana &
    sleep 2
    echo "start kibana success"
}

stop() {
    kib_pid=$(ps aux|grep kibana|grep -v grep|awk '{print $2}')
    kill -9 ${kib_pid}
    sleep 2
    echo "stop kibana success"
}

case $1 in
    start)
        start;;
    stop)
        stop;;
    restart)
        stop
        start;;
    *)
        echo "Usage: start|stop|restart"
esac
